package com.aaa.utils;

import org.springframework.http.MediaType;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

/**
 * @author : luoBo
 * 请求头返回的数据
 */
public class ResponseUtil {
    public static void writeError(HttpServletResponse response,String jsonResultStr) {
        response.setContentType(MediaType.APPLICATION_JSON_VALUE);
        response.setCharacterEncoding(StandardCharsets.UTF_8.name());
        try {
            response.getWriter().write(jsonResultStr);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
